package com.storm;

import ch01.storm.RandomSpout;
import ch01.storm.SenqueceBolt;
import org.apache.storm.Config;
import org.apache.storm.LocalCluster;
import org.apache.storm.topology.TopologyBuilder;
import org.apache.storm.utils.Utils;
import org.junit.Test;

/**
 * Created by User on 2016/11/12.
 */
public class FirstTop {

    @Test
    public void fistTest() throws Exception {
        TopologyBuilder builder = new TopologyBuilder();
        builder.setSpout("spout", new RandomSpout());
        builder.setBolt("bolt", new SenqueceBolt()).shuffleGrouping("spout");
        Config conf = new Config();
        conf.setDebug(false);
        LocalCluster cluster = new LocalCluster();
        cluster.submitTopology("firstTopo", conf, builder.createTopology());
        Utils.sleep(100000);
        cluster.killTopology("firstTopo");
        cluster.shutdown();
    }
}
